﻿@model IEnumerable<HelloMinasan.Domain.SongReport>

@{
    ViewBag.Title = "LyricReport";
    int NextPageNumber = (int)ViewData["NextPageNumber"];
    int PreviousPageNumber = (int)ViewData["PreviousPageNumber"];
    int TotalPageCount = (int)ViewData["TotalPageCount"];
    int CurrentPageNumber = (int)ViewData["CurrentPageNumber"];
}

<script>
    function gotoSongReportPage(jslyricid, jssongid, jscurrentpage, jspagenumber) {
        $("#loaderIndicator").show();
        $.ajax(
            {
                type: "POST",
                url: "/Report/LyricReport",
                data: {lyricid:jslyricid, songid: jssongid, currentpage: jscurrentpage, pagenumber: jspagenumber },
                success: function (result) {
                    location = location.href;
                },
                error: function (error) {
                    alert(error);
                }
            });
    }

    function jumpToPageSongReport(pageElement,lyricid, songId, jspagenumber) {
        var jscurrentpage = $(pageElement).val();
        gotoSongReportPage(lyricid, songId, jscurrentpage, jspagenumber);
    }

    function DeleteSongReport(pid) {
        if (confirm("Do you want to delete product?")) {
            var data = { 'Id': pid }
            $.post('/Report/Delete', data,
            function (data) {
                if (data == true)
                    location = location.href;
                else
                    alert("Could not delete");
            });
        }
    }

    function AddBadWordsFilter() {
        $("#errorMessage").html("");
        var BadWords = $("#BadWordsFilter").val();
        var Lang = $("#comboboxLanguage22").val();
        if (BadWords.length < 1) {
            $("#errorMessage").html("Can't be less than 1 characters.");
            return;
        }
        $("#reportingDiv").hide();
        $("#loadingIndicatorReportSong").show();
        $.ajax(
            {
                type: "POST",
                url: "/Report/InsertBadWord",
                data: { BadWord: BadWords, lang: Lang },
                success: function (result) {
                    if (result.Result) {
                        $("#loadingIndicatorReportSong").hide();
                        $.msgbox(result.Message, { type: "info" });
                    }
                    else {
                        $.msgbox(result.Message, { type: "error" });
                    }
                }
            });
    }
</script>

@*tiêu đề*@
<div class="contentSection">
     <div style="padding-left:40px;">
        <a href="/Song/Songs/@Model.First().Song.Id">
              <span class="titleNewFont" style="font-size: 20px; font-weight: normal">Lyric for: @Model.First().Song.SongName</span>
        </a>
        <hr />
    </div>
 </div>

@*nội dung*@
<div class="contentSectionInside" style="margin-bottom: 10px;">
    <table style= "width: 100%">
         @foreach (var item in Model)
         {
             <tr class="divListSong" style= "width: 100%">
                  <td style= "width: 5%">
                      <a href="#" onclick="DeleteSongReport(@item.ID)" title="Delate">
                          <img src="~/Content/Images/report_delete.png" />
                      </a>
                  </td>
                  <td style= "width: 80%">
                    <div class="titleSongName">
                        @item.ReportComment
                    </div>
                    <span style="float:inherit;">Date Post:@item.ReportDate</span>
                 </td>
                 <td style= "width: 10%"><span style="float: left;">By:@item.User.Username</span></td>
                 </tr>   
         }
   </table>
</div>

@*margin-bottom: 5px; margin-top: 5px;*@
<br />
<div align="center" style="margin-top: 10px;">
    @if (PreviousPageNumber > 0)
    {
        <a onclick="gotoSongReportPage(@Model.First().LyricID, @Model.First().Song.Id, 1, 10)" class="buttonClass">First</a>
        <a onclick="gotoSongReportPage(@Model.First().LyricID, @Model.First().Song.Id, @CurrentPageNumber +1, 10)" class="buttonClass">Back</a>
    }
    <select onchange="jumpToPageSongReport(this,@Model.First().LyricID, @Model.First().Song.Id, 10)">
        @for (int i = 1; i <= TotalPageCount; i++)
        {
            if (i != CurrentPageNumber)
            { <option value="@i">@i</option> }
            else
            { <option value="@i" selected>@i</option> }
        }
    </select>
    @if (NextPageNumber <= TotalPageCount)
    {
        <a onclick="gotoSongReportPage(@Model.First().LyricID, @Model.First().Song.Id, @CurrentPageNumber +1, 10)" class="buttonClass">Next</a>
        <a onclick="gotoSongReportPage(@Model.First().LyricID, @Model.First().Song.Id, @TotalPageCount, 10)" class="buttonClass">Last</a>
    }
</div>
@*phần thêm Bad Words Filte *@
<div id="tooltipSectionFunction">
    <div align="right" style="margin-bottom: 5px;"><b title="Hide" style="cursor: pointer">Add</b></div>
    <div id="tooltipSectionContent" align="center">

        <div class="icon">
            <div class="description">
                <div class="positionTheTooltip">
                    <div class="contentSectionInside" style="width: 350px;">
                        <strong>Add Bad Words Filter</strong>
                    </div>
                    <div class="contentSectionInside" align="left" style="width: 350px;">
                         <span id="comboboxLanguage1">
                             <select id="comboboxLanguage22">
                                 <option value="1">English</option>
                                 <option value="2">Vietnamese</option>
                                 <option value="3">Korea</option>
                                 <option value="4">Indonesia</option>
                                 <option value="5">Chinese</option>
                             </select>
                         </span>
                        <br /><span id="errorMessage"></span>
                        <div>Bad Words Filterent:</div>
                        <input id="BadWordsFilter" type="text" style="width: 320px;" />
                        <div align="right"><a class="linkText" onclick="AddBadWordsFilter()">Add</a></div>
                    </div>
                </div>
            </div>

            <div class="iconShortcut">
                <img style="display:none;margin-top:20px;" id="loadingIndicatorReportSong" src="@Url.Content("~/Content/Images/loader.gif")" />
                <img title="Report this song" src="@Url.Content("~/Content/Images/document-broken.png")" /><br />
                Add Bad Words Filter
            </div>
        </div>
    </div>
</div>